﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MadProps
{
    public abstract class Meta
    {
        protected Meta()
        {
            throw new Exception("TODO do not instantiate this class");
        }

        public class Key<T>
        {
            internal readonly string theString;
            public Key(string key)
            {
                this.theString = key;
            }

            public T Of(IHavePropId prop)
            {
                return Definition.MetadataStore.GetValue(prop.PropId, this);
            }
        }

        public class ArbitraryAttribute : BaseAttribute
        {
            public ArbitraryAttribute(string key, object value)
                : base(value, key)
            {
            }
        }

        public static readonly Key<string> PropertyName = new Key<string>("PropertyName");
        public class PropertyNameAttribute : BaseAttribute
        {
            public PropertyNameAttribute(string value) : base(value) { }
        }

        public static readonly Key<string> DisplayName = new Key<string>("DisplayName");
        public sealed class DisplayNameAttribute : BaseAttribute
        {
            public DisplayNameAttribute(string value) : base(value) { }
        }

        public static readonly Key<string> Description = new Key<string>("Description");
        public class DescriptionAttribute : BaseAttribute
        {
            public DescriptionAttribute(string value) : base(value) { }
        }

        public static readonly Key<bool> IsReadOnly = new Key<bool>("IsReadOnly");
        public class IsReadOnlyAttribute : BaseAttribute
        {
            public IsReadOnlyAttribute(bool value) : base(value) { }
        }

        public static readonly Key<bool> IsRequired = new Key<bool>("IsRequired");
        public class IsRequiredAttribute : BaseAttribute
        {
            public IsRequiredAttribute(bool value) : base(value) { }
        }

        public static readonly Key<Tracking> Tracking = new Key<Tracking>("Tracking");
        public class TrackingAttribute : BaseAttribute
        {
            public TrackingAttribute(Tracking value) : base(value) { }
        }
    }
}
